/*

Copyright 2007 Renaun Erickson (http://renaun.com)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

@ignore
*/
package asfslib.api.familytree.v1
{
	import mx.collections.ArrayCollection;
	

/**
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="assertion">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="citations" minOccurs="0">
 *           &lt;complexType>
 *             &lt;complexContent>
 *               &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 &lt;sequence>
 *                   &lt;element name="citation" type="{http://api.familysearch.org/familytree/v1}citation" maxOccurs="unbounded" minOccurs="0"/>
 *                 &lt;/sequence>
 *               &lt;/restriction>
 *             &lt;/complexContent>
 *           &lt;/complexType>
 *         &lt;/element>
 *         &lt;element name="contributor" type="{http://api.familysearch.org/familytree/v1}contributorReference" minOccurs="0"/>
 *         &lt;element name="notes" minOccurs="0">
 *           &lt;complexType>
 *             &lt;complexContent>
 *               &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 &lt;sequence>
 *                   &lt;element name="note" type="{http://api.familysearch.org/familytree/v1}note" maxOccurs="unbounded" minOccurs="0"/>
 *                 &lt;/sequence>
 *               &lt;/restriction>
 *             &lt;/complexContent>
 *           &lt;/complexType>
 *         &lt;/element>
 *       &lt;/sequence>
 *       &lt;attribute name="disputing" type="{http://www.w3.org/2001/XMLSchema}boolean" />
 *       &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       &lt;attribute name="modified" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
 *       &lt;attribute name="tempId" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       &lt;attribute name="version" type="{http://www.w3.org/2001/XMLSchema}string" />
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
public class Assertion 
{

    //--------------------------------------------------------------------------
    //
    //  Constants
    //
    //--------------------------------------------------------------------------
    
    /**
     * 	The assertion type name
     */
    public static const TYPE_NAME:String = "name";
    
    /**
     * 	The assertion type gender
     */
    public static const TYPE_GENDER:String = "gender";
    
    /**
     * 	The assertion type event
     */
    public static const TYPE_EVENT:String = "event";
    
    /**
     * 	The assertion type fact
     */
    public static const TYPE_FACT:String = "fact";
    
    /**
     * 	The assertion type ordinance
     */
    public static const TYPE_ORDINANCE:String = "ordinance";
    
    /**
     * 	The assertion type relationship
     */
    public static const TYPE_RELATIONSHIP:String = "relationship";
	
    //----------------------------------
    //  citations
    //----------------------------------

    /**
     *  @private
     *  Storage for the citations property.
     */
    private var _citations:ArrayCollection;

    /**
     *  The citations property
     *
     *  @default 
     */
    public function get citations():ArrayCollection
    {
        return _citations;
    }

    /**
     *  @private
     */
    public function set citations(value:ArrayCollection):void
    {
        _citations = value;
    }


    //----------------------------------
    //  contributor
    //----------------------------------

    /**
     *  @private
     *  Storage for the contributor property.
     */
    private var _contributor:ContributorReference;

    /**
     *  The contributor property
     *
     *  @default 
     */
    public function get contributor():ContributorReference
    {
        return _contributor;
    }

    /**
     *  @private
     */
    public function set contributor(value:ContributorReference):void
    {
        _contributor = value;
    }


    //----------------------------------
    //  notes
    //----------------------------------

    /**
     *  @private
     *  Storage for the notes property.
     */
    private var _notes:ArrayCollection;

    /**
     *  The notes property
     *
     *  @default 
     */
    public function get notes():ArrayCollection
    {
        return _notes;
    }

    /**
     *  @private
     */
    public function set notes(value:ArrayCollection):void
    {
        _notes = value;
    }


    //----------------------------------
    //  disputing
    //----------------------------------

    /**
     *  @private
     *  Storage for the disputing property.
     */
    private var _disputing:Boolean = false;

    /**
     *  The disputing property
     *
     *  @default  = false
     */
    public function get disputing():Boolean
    {
        return _disputing;
    }

    /**
     *  @private
     */
    public function set disputing(value:Boolean):void
    {
        _disputing = value;
    }


    //----------------------------------
    //  id
    //----------------------------------

    /**
     *  @private
     *  Storage for the id property.
     */
    private var _id:String = "";

    /**
     *  The id property
     *
     *  @default  = ""
     */
    public function get id():String
    {
        return _id;
    }

    /**
     *  @private
     */
    public function set id(value:String):void
    {
        _id = value;
    }


    //----------------------------------
    //  modified
    //----------------------------------

    /**
     *  @private
     *  Storage for the modified property.
     */
    private var _modified:String = "";

    /**
     *  The modified property
     *
     *  @default  = ""
     */
    public function get modified():String
    {
        return _modified;
    }

    /**
     *  @private
     */
    public function set modified(value:String):void
    {
        _modified = value;
    }


    //----------------------------------
    //  tempId
    //----------------------------------

    /**
     *  @private
     *  Storage for the tempId property.
     */
    private var _tempId:String = "";

    /**
     *  The tempId property
     *
     *  @default  = ""
     */
    public function get tempId():String
    {
        return _tempId;
    }

    /**
     *  @private
     */
    public function set tempId(value:String):void
    {
        _tempId = value;
    }


    //----------------------------------
    //  version
    //----------------------------------

    /**
     *  @private
     *  Storage for the version property.
     */
    private var _version:String = "";

    /**
     *  The version property
     *
     *  @default  = ""
     */
    public function get version():String
    {
        return _version;
    }

    /**
     *  @private
     */
    public function set version(value:String):void
    {
        _version = value;
    }


    //----------------------------------
    //  otherAttributes
    //----------------------------------

    /**
     *  @private
     *  Storage for the otherAttributes property.
     */
    private var _otherAttributes:Object = new Object();

    /**
     *  The otherAttributes property
     *
     *  @default 
     */
    public function get otherAttributes():Object
    {
        return _otherAttributes;
    }

    /**
     *  @private
     */
    public function set otherAttributes(value:Object):void
    {
        _otherAttributes = value;
    }


    //----------------------------------
    //
    //  Methods
    //
    //----------------------------------
	
	/**
	 * 	Make a clone of this instance
	 */
    public function clone():Assertion
    {
    	var target:Assertion = new Assertion();
		copy(target);
        return target;
    }	

	/**
	 * 	Make a clone of this instance
	 */
    protected function copy(target:Assertion):void
    {
    	target.citations = new ArrayCollection(citations.source);
    	target.notes = new ArrayCollection(notes.source);
    	target.contributor = contributor.clone();
    	target.disputing = disputing;
    	target.id = id;
    	target.tempId = tempId;
    	var newAttributes:Object = new Object();
    	for (var key:String in otherAttributes)
    		newAttributes[key] = otherAttributes[key]
    	target.otherAttributes = newAttributes;
    }

}
}
